import Upload from "@/components/upload.vue";
import axios from "../utils/request";
import path from "./path"

const dataToSend = {
    username:"左乐"
}
const api ={
    
    Login(username,password){
        return axios.post(path.baseUrl+path.login,{username,password});
    },
    AddUser(){
        return axios.post("http://localhost:8888/video/test",dataToSend)
    },
    GetVideo(vid){
        return axios.get(path.baseUrl+path.getVideo.replace('{vid}',vid));
    },
    GetVideoByBlob(vid){
        return axios.get(`http://localhost:8888/video/blob/${vid}`, {
            responseType: 'blob'
        });
    },
    UploadVideo(formData){
        return axios.post('http://localhost:8888/video/upload',formData, { headers: {
            'Content-Type': 'multipart/form-data'
        }});
    },
    Register(data){
        return axios.post(path.baseUrl+path.register,data);
    },
    GetValidCodePic(){
        return axios.post(path.baseUrl+path.getValidCodePic,dataToSend,{
            'Content-Type': 'application/json'
        });
    },
    TextValidCode(code){
        return axios.post(path.baseUrl+path.testValidCode,code,{
            'Content-Type': 'application/json'
        });
    }
}
export default api;